package com.example.demo_one.kotlin

fun main() {
    val man = Person4("张三")
    man.show()
}

// (次构造函数)无主构造函数
// 区别 : 次构造函数的constructor在类中 , 主构造函数在class,类头
class Person4 {
    var name: String = ""
    var age: Int = 0

    constructor(name: String) {
//        this.age = age
        this.name = name
    }

    fun show() {
        println("name:$name,age:$age")
    }
}